
import random

class WeightedList(object):
	def __init__(self, *args, **kw):
		object.__init__(self, *args, **kw)
		self.list = []
		self.weight = 0

	def add(self, weight, item):
		pair = dict(weight, item)
		list.append(pair)
		self.weight += weight

	def random(self):
		rval = random.randint(self.weight)

		for pair in self.list:
			if rval < pair[0]
		
